home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-24 | 2.5 KB | 69 lines | [TEXT/MPS ] |
- #
- # v.FileList
- # MPW Shell script
- # Kerry Laidlaw
- # Apple Computer, Inc.
- #
- # Function:
- # Help the user build a list of corresponding files from a
- # master to a test disk. It does this by generating a list
- # of the files on the two disks and asking the user (via dialog
- # boxes) for the names of the test files that it cannot figure out.
- #
-
- # Save some initial shell variable values, and set them for our own use
-
- set saveExit {exit}
- set exit 0 # Set exit 0 so we won't abort if status variable is non-zero
- set saveEcho {echo} # echo=1 for echoing each command before execution
- set echo 0
- set saveDir `directory`
-
- directory "{MasterFolder}"
- directory ::
-
- # delete -y -i "{FileList}" # Delete the list if it exists already
-
- # Get the file list for the US disk. The options ask for recursive
- # search, full pathnames, and files only. The output file is a temp file.
- files -r -f -s "{TestFolder}" > "{FileList}".loc
-
- # Loop on the localized files and prompt the user for the test files we cannot
- # figure out. Use the type and creator of the US files to search for the
- # test file. If we find only one, it must be the file we're looking for.
- # If we find more than one, ask the user for help.
-
- for file in `catenate "{FileList}".loc`
- continue if "{file}" =~ /≈Desktop/ # Skip the desktop file.
- # Search the TestFolder. The output of this files should NOT be quoted (-q).
- # Remember to quote the creator to include possible trailing spaces!
- files -r -f -s -q -t `catinfo -t -q "{file}"` -c "`catinfo -c -q "{file}"`" "{MasterFolder}" > "{FileList}".us
- if `count -l "{FileList}".us` == 1 # If only one line of output
- catenate "{FileList}".us >> "{FileList}"
- echo "{file}" >> "{FileList}" # Add it now.
- continue # And don't ask the user.
- end
- # If there is more than one, ask the user for help in choosing.
- set tmp "`getlistitem -q -m "The Master ∂"{file}∂" is" < "{FileList}".us ∂
- || set sstatus {status}`"
- if {sstatus} != 0 # If cancel, then cleanup and exit.
- #delete "{FileList}".us "{FileList}".loc
- #exit 2
- continue # Have cancel skip this particular match, and go on to the next one
- end # end of if cancel
- echo "{tmp}" >> "{FileList}"
- echo "{file}" >> "{FileList}" # Add the user's choice to the list.
- end
-
- # Clean up and exit.
-
- delete "{FileList}".us "{FileList}".loc # Remove the temp files.
-
- # Alert "The following File List was created:∂n∂n∂t" ∂""{FileList}"∂"
-
-
- # Restore shell variables and exit
-
- directory "{saveDir}" # Leave the directory setting unchanged
- set echo {saveEcho} # restore echo
- set exit "{saveExit}"